# -*- coding: utf-8 -*-
import time

from web_pom_project.base.WebKeys import WebKeys


class CommentPage(WebKeys):
    def comment(self,book):
        # 找某一本书进行点击
        self.locator_with_wait("link text",book).click()
        # 显性等待发表评论按钮，并进行点击
        locator = ("link text", "发表评论")
        self.locator_with_wait(*locator).click()

        # 显性等待评论输入框，并进行输入
        content = f"发表评论-{str(int(time.time()))}"
        locator = ("id", "txtComment")
        self.locator_with_wait(*locator).send_keys(content)

        # 显性等待发表按钮，并进行点击
        locator = ("css selector", ".fr>.btn_ora")
        self.locator_with_wait(*locator).click()


    def get_result_text(self):
        locator = ("css selector", ".layui-layer-content")
        result=self.get_text(*locator)
        return result
